import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, OneToMany } from 'typeorm';

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ unique: true })
  username: string;

  @Column()
  password: string;

  @Column()
  role: number;

  @Column()
  name: string;

  @ManyToOne(() => User, user => user.subordinates)
  supervisor: User;

  @OneToMany(() => User, user => user.supervisor)
  subordinates: User[];
} 